package com.example.testhilt.app

import android.app.Application
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ApplicationComponent

/**
 ********************************************************
 *Author: chinadragon
 *Time: 2020/11/24 3:42 PM
 *Name:
 *Overview:
 *Usage:
 ********************************************************
 */
@Module
@InstallIn(ApplicationComponent::class)
class ApplicationModule {
    @Provides
    fun provideMyApplication(application: Application):HiltApplication{
        return application as HiltApplication
    }

    /*

        接下来你在Truck类中就可以去这样声明依赖了：

        class Driver @Inject constructor(val application: MyApplication) {
        }

     */
}